export const verify = {
  id: [{ type: "string", required: true }],
  name: [
    { type: "string", required: true },
    { min: 2, max: 10, message: "用户名长度必须在2到10个字符之间" },
  ],
  username: [
    { type: "string", required: true },
    { min: 5, max: 10, message: "账户长度必须在5到10个字符之间" },
  ],
  password: [{ type: "string", required: true }],
  email: [
    { type: "string", required: true },
    {
      pattern: /^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$/,
      message: "邮箱格式不正确",
    },
  ],
  code: [{ type: "string", required: true }],
  page: [{ type: "number" }],
  size: [{ type: "number" }],
  sortkey: [{ type: "string" }],
  sortway: [
    { type: "number" },
    { enum: [-1, 1], message: "排序方式只能是-1或1" },
  ],
};

export const keys = {
  logup: ["name", "username", "password", "email", "code"],
  login: ["username", "password", "code"],
  list: ["name", "username", "email", "page", "size", "sortkey", "sortway"],
  update: ["id", "code", "name", "username", "password", "email"],
};
